/**
 * @param {number[]} prices
 * @return {number}
 */
var maxProfit = function (prices) {
  let res = 0
  for(let i=0;i<prices.length;i++){
    for(let j=i+1;i<prices.length;j++){
      res= Math.max(res,prices[j]-prices[i])
    }
  }

  return res
};